﻿<%@ Page Title="Report" Language="C#" MasterPageFile="~/Admin/Membership.master"
    AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Admin_Report" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <br />
    <br />   <br />
    <br />
     <br />
    <style type="text/css">
        .viewWrap
        {
            padding: 15px;
            background: #2291b5 0 0 url(Img/bluegradient.gif) repeat-x;
        }
        .contactWrap
        {
            padding: 10px 15px 15px 15px;
            background: #fff;
            color: #333;
        }
        .contactWrap td
        {
            padding: 0 20px 0 0;
        }
        .contactWrap td td
        {
            padding: 3px 20px 3px 0;
        }
        .contactWrap img
        {
            border: 1px solid #05679d;
        }
    </style>
    <table>
        <tr>
            <td>
                Vendor
            </td>
            <td>
                <asp:DropDownList ID="dropVendor" runat="server">
                </asp:DropDownList>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Select vendor"
                    ControlToValidate="dropVendor" InitialValue="0">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Deal From
            </td>
            <td>
                <telerik:RadDatePicker ID="RadDatePicker1" runat="server" />
                <div style="clear: both">
                </div>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadDatePicker1"
                    ErrorMessage="Enter  deal to date">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Deal To
            </td>
            <td>
                <telerik:RadDatePicker ID="RadDatePicker2" runat="server" />
                <div style="clear: both">
                </div>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="RadDatePicker2"
                    ErrorMessage="Enter  deal from date">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                &nbsp;
                <asp:Button ID="btnReport" runat="server" Text="Generate Report" Width="152px" OnClick="btnReport_Click" />
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="False"
                    ShowSummary="True" />
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" runat="server" AutoGenerateColumns="False"
                    AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="False" PageSize="3"
                    GridLines="None" ShowGroupPanel="true" OnItemCreated="RadGrid1_ItemCreated" OnItemCommand="RadGrid1_ItemCommand"
                    OnItemDataBound="RadGrid1_ItemDataBound" Skin="WebBlue" Visible="false">
                    <GroupPanel Text="Report">
                    </GroupPanel>
                    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                    <MasterTableView DataKeyNames="DealID,VendorID" AllowMultiColumnSorting="True" GroupLoadMode="Server">
                        <NestedViewTemplate>
                            <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
                                <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">
                                    <Tabs>
                                        <telerik:RadTab runat="server" Text="Purchse Details" PageViewID="PageView1">
                                        </telerik:RadTab>
                                        <telerik:RadTab runat="server" Text="Vendor Contact Information" PageViewID="PageView2">
                                        </telerik:RadTab>
                                    </Tabs>
                                </telerik:RadTabStrip>
                                <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                                    <telerik:RadPageView runat="server" ID="PageView1">
                                        <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("DealID") %>'
                                            Visible="false" runat="server" />
                                        <telerik:RadGrid runat="server" ID="OrdersGrid" ShowFooter="true" AllowSorting="true"
                                            EnableLinqExpressions="false">
                                            <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="False"
                                                DataKeyNames="DealID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                                                <Columns>
                                                    <telerik:GridBoundColumn SortExpression="Buyer Name" HeaderText="Name" DataField="UserName"
                                                        UniqueName="UserName">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn SortExpression="TransactionID" HeaderText="TransactionID"
                                                        DataField="transactionID" UniqueName="TransactionID">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn SortExpression="CouponCode" HeaderText="CouponCode" DataField="CouponCode"
                                                        UniqueName="CouponCode">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridDateTimeColumn SortExpression="StartDate" HeaderText="Purchase Date"
                                                        DataField="StartDate" UniqueName="StartDate" DataFormatString="{0:MM/dd/yyyy}">
                                                    </telerik:GridDateTimeColumn>
                                                    <telerik:GridBoundColumn UniqueName="TotalPurchaseQty" DataField="TotalPurchaseQty"
                                                        HeaderText="Total Purchase Qty" Aggregate="Sum" FooterText="Total Qty: ">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn UniqueName="Total" DataField="Total" HeaderText="Selling Price"
                                                        DataFormatString="{0:C}">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn  UniqueName="SubTotal" DataField="PurchaseAmount"
                                                        HeaderText="Purchase Amount" DataFormatString="{0:C}">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn UniqueName="Credit" DataField="Credit" HeaderText="Credit Applied" DataFormatString="{0:C}">
                                                    </telerik:GridBoundColumn>
                                                       <telerik:GridBoundColumn Aggregate="Sum" UniqueName="NetAmount" DataField="NetAmount" HeaderText="Net Amount" DataFormatString="{0:C}" FooterText="Total Amount: ">
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                            </MasterTableView>
                                        </telerik:RadGrid>
                                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Visible="False"
                                            ShowFooter="true" OnRowDataBound="GridView1_OnRowDataBound" DataKeyNames="Total,TotalPurchaseQty,DealTitle,DealID">
                                            <Columns>
                                                <asp:BoundField DataField="UserName" HeaderText="Buyer Name" />
                                                <asp:BoundField DataField="transactionID" HeaderText="TransactionID" />
                                                <asp:BoundField DataField="CouponCode" HeaderText="CouponCode" />
                                                <asp:BoundField DataField="StartDate" HeaderText="Purchase Date" DataFormatString="{0:MM/dd/yyyy}" />
                                                <asp:BoundField DataField="TotalPurchaseQty" HeaderText="Total Purchase Qty" />
                                                <asp:BoundField DataField="Total" HeaderText="Selling Price" DataFormatString="{0:C}" />
                                                <asp:BoundField DataField="PurchaseAmount" HeaderText="Purchase Amount" DataFormatString="{0:C}" />
                                                 <asp:BoundField DataField="Credit" HeaderText="Credit Applied" />
                                                       <asp:BoundField DataField="NetAmount" HeaderText="Net Amount" />
                                                <%-- <asp:BoundField DataField="Subtotal" HeaderText="Total Amount" />--%>
                                            </Columns>
                                        </asp:GridView>
                                        <br />
                                        <br />
                                        <asp:Button ID="Button1" CssClass="button" Width="150px" Text="Export to Excel" OnClick="Button1_Click"
                                            runat="server" Visible="false"></asp:Button>
                                    </telerik:RadPageView>
                                    <telerik:RadPageView runat="server" ID="PageView2" Width="460px">
                                        <div class="contactWrap">
                                            <table cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td>
                                                        <img src="../Images/discuss_deal1.jpg" alt="Vendor Image" />
                                                    </td>
                                                    <td>
                                                        <asp:DetailsView ID="DetailsView1" AllowPaging="true" GridLines="None" Width="100%"
                                                            runat="server" Font-Italic="true" AutoGenerateRows="false">
                                                            <Fields>
                                                                <asp:BoundField HeaderStyle-Font-Italic="false" HeaderStyle-Font-Bold="true" HeaderText="Vendor Name:"
                                                                    DataField="VendorName" />
                                                                <asp:BoundField HeaderText="Address:" DataField="Address1" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />
                                                                <asp:BoundField HeaderText="City:" DataField="city" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />
                                                                <asp:BoundField HeaderText="State:" DataField="State" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />
                                                                <asp:BoundField HeaderText="ZipCode:" DataField="ZipCode" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />
                                                                <%--<asp:BoundField HeaderText="PhoneNo:" DataField="Phone" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />--%>
                                                                <asp:BoundField HeaderText="Email:" DataField="Email" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />
                                                                <asp:BoundField HeaderText="Website:" DataField="Website" HeaderStyle-Font-Italic="false"
                                                                    HeaderStyle-Font-Bold="true" />
                                                            </Fields>
                                                        </asp:DetailsView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </telerik:RadPageView>
                                </telerik:RadMultiPage>
                            </asp:Panel>
                        </NestedViewTemplate>
                        <ExpandCollapseColumn Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name" DataField="Name"
                                SortExpression="Name">
                                <ItemTemplate>
                                    <asp:Label ID="lblNAme" runat="server" Text='<%# TrimDescription(Eval("Name") as string) %>' />
                                </ItemTemplate>
                                <ItemStyle VerticalAlign="Top" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Description" UniqueName="Description" DataField="Description">
                                <ItemTemplate>
                                    <asp:Label ID="lblDescription" runat="server" Text='<%# TrimDescription(Eval("Description") as string) %>' />
                                </ItemTemplate>
                                <ItemStyle VerticalAlign="Top" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Price">
                                <ItemTemplate>
                                    <asp:Label ID="lblPrice" runat="server" Text="" />
                                </ItemTemplate>
                                <ItemStyle VerticalAlign="Top" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Date">
                                <ItemTemplate>
                                    <asp:Label ID="lblDate" runat="server" Text="" />
                                </ItemTemplate>
                                <ItemStyle VerticalAlign="Top" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="City" UniqueName="City" DataField="City"
                                SortExpression="City">
                                <ItemTemplate>
                                    <asp:Label ID="lblCity" runat="server" Text='<%#Bind("City")%>' />
                                </ItemTemplate>
                                <ItemStyle VerticalAlign="Top" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Image">
                                <ItemTemplate>
                                    <asp:Image ID="Image1" Height="100" Width="100" runat="server" ImageUrl='<%# Eval("DealID", "ImageDisplay.aspx?DealID={0}")%>' />
                                </ItemTemplate>
                                <ItemStyle VerticalAlign="Top" />
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings AllowDragToGroup="true" />
                </telerik:RadGrid>
            </td>
        </tr>
    </table>
</asp:Content>
